<fieldset>

    <legend>条件搜索</legend>

    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">访客姓名</label>
            <div class="layui-input-inline">
                {if $userinfo['db1']['authorize'] == 1}
                  <input name="name" value="{$Think.get.name|default=''}" placeholder="请输入访客姓名" class="layui-input">
                {else}
                  <input name="vister_name" value="{$Think.get.vister_name|default=''}" placeholder="请输入访客姓名" class="layui-input">
                {/if}
            </div>
        </div>
                <div class="layui-form-item layui-inline">
            <label class="layui-form-label">访客联系电话</label>
            <div class="layui-input-inline">
                {if $userinfo['db1']['authorize'] == 1}
                  <input name="mobile" value="{$Think.get.mobile|default=''}" placeholder="请输入访客联系电话" class="layui-input">
                {else}
                  <input name="vister_mobile" value="{$Think.get.vister_mobile|default=''}" placeholder="请输入访客联系电话" class="layui-input">
                {/if}
            </div>
        </div>

		    {if $userinfo['db1']['authorize'] == 1 || $userinfo['db1']['authorize'] == 8}
        <div class="layui-form-item layui-inline">
          {if $userinfo['db1']['authorize'] == 1 }
             <label class="layui-form-label">所属公司</label>
                         <div class="layui-input-inline">
                <input name="company_name" value="{$Think.get.company_name|default=''}" placeholder="请输入公司名称" class="layui-input">
            </div>
          {else}
            <!--  <label class="layui-form-label">拜访公司</label>
                         <div class="layui-input-inline">
                <input name="app_company_name" value="{$Think.get.app_company_name|default=''}" placeholder="请输入公司名称" class="layui-input">
            </div> -->
          {/if}
           

        </div>  
  {/if}

 {if $userinfo['db1']['authorize'] == 2}
<!-- 		<div class="layui-form-item layui-inline">
		    <label class="layui-form-label">拜访部门</label>
		    <div class="layui-input-inline">
		        <input name="address" value="{$Think.get.address|default=''}" placeholder="请输入拜访部门名字" class="layui-input">
		    </div>
		</div> -->
  {/if}
  {if $userinfo['db1']['authorize'] != 1}
<!--         <div class="layui-form-item layui-inline">
            <label class="layui-form-label">到访情况</label>
            <div class="layui-input-inline">
                <select class="layui-select" name="status">
                    {foreach [''=>'-- 全部状态 --','1'=>'未访问访客','2'=>'已完成访问访客'] as $k=>$v}
                    {eq name='Think.get.status' value='$k.""'}
                    <option selected value="{$k}">{$v}</option>
                    {else}
                    <option value="{$k}">{$v}</option>
                    {/eq}
                    {/foreach}
                </select>
        </div>
            </div> -->
  {/if}
{if $userinfo['db1']['authorize'] == 2}
       <div class="layui-form-item layui-inline">
          <label class="layui-form-label">查看访问时间</label>
          <div class="layui-input-inline">
      		  <input type="text" class="layui-input" id="create_at_first" name="create_at_first" value="{$Think.get.create_at_first|default=''}"  placeholder="请选择时间">			 

          </div>
        <div class="layui-form-mid">—</div>
      	   <div class="layui-input-inline">
      	<input type="text" class="layui-input" id="create_at_last" name="create_at_last" value="{$Think.get.create_at_last|default=''}"  placeholder="请选择时间">
      	</div>
      </div>
{/if}
 <input type="hidden" name="true_spm" value="m-70-71-207">
        <div class="layui-form-item layui-inline">
            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
        </div>
    </form>

</fieldset>

<script>form.render()</script>
<script>
layui.use('laydate', function(){
  var laydate = layui.laydate;
  
  //执行一个laydate实例
  laydate.render({
    elem: '#create_at_first' //指定元素
  });
   laydate.render({
    elem: '#create_at_last' //指定元素
  });
});
</script>
<script>
	$("#singcms-button-submit").click(function() {
	    var data = $("#singcms-form").serializeArray();
	    postData = {};
	    $(data).each(function(i) {
	        postData[this.name]= this.value;
	    });
		// postData['create_at']=create_at;
	    console.log(postData);
		
	    // 将获取到的数据post给服务器
	    url = SCOPE.save_url;
	    jump_url = SCOPE.jump_url;
	    $.post(url, postData, function(result) {
	        if (result.code == 200) {
	            //成功
	            return dialog.success(result.message, jump_url);
	        } else if (result.code == 400) {
	            // 失败
	            return dialog.error(result.message);
	        }
	    }, "JSON");
	});
	


</script>
<script>
		var SCOPE = {
		'save_url' : "{:url('visitor/visitor/index')}",
		'jump_url' : "{:url('visitor/visitor/index')}",
	
	};
</script>